<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"/>
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib prefix="frame" uri="http://www.framework.com/taglib"%>
       <div>
         <input type="hidden" name="projectId" value="${projectId}" id="projectId"/> 	       
       <div class="easyui-panel" data-options="border:true,title:'非中标保证金'" style="height:260px;padding: 1px;margin-bottom: 6px">
         <div id="mydialog"></div>
         </div>
         <c:if test="${isShowBid}">
         <div class="easyui-panel" data-options="border:true,title:'中标保证金'" style="height:160px;padding: 1px;margin-bottom: 6px">
         <div id="mydialog2"></div>   
         </div> 
         </c:if> 
         <c:if test="${showButtonFlag}">   
	        <tr>
			    <td colspan="4">
			       <center><a id="submit" class="easyui-linkbutton">保证金操作完成</a></center> 
			    </td> 
			</tr>	
		 </c:if>    
       </div>
	    <script type="text/javascript">
	     var projectId=$("#projectId").val();
	    $(function(){   
	         $('#mydialog').datagrid({
	                     idField:'id',
	                     width:'980',
	                     height:225,
                         url:'${ctx}/business/projectmanage/leader/getProjectBidList?projectId='+projectId+"&type=0&pageSize=100",
	                     fitColumns:true,//自动填充宽度
	                     striped:true,//隔行变色
	                     loadMsg:"数据正在加载中.....",
	                     rownumbers:true,//显示序号
	                     singleSelect:true,
	                     pagination:false,
	                     nowrap:false,                    
	                     pageSize:5,
	                     pageList:[10,15,20],
	                     columns:[[   
	                    // {field:'ck',checkbox:true }, 
	                     {field:'pk',title:'单位名称',width:150,align:'center',formatter:fromatterCompanyName}, 		
	                  //   {field:'biaoDuanNo',title:'项目标段号', align:'center',width:200},
				         {field:'tnAmount',title:'缴纳金额',width:100,align:'center'},
				         {field:'transTime',title:'缴纳时间',width:150,align:'center'},
				         {field:'hstSeqNum',title:'交易流水号', align:'center',width:100,formatter:fromatterHstSeqNum},
				         {field:'bid',title:'是否投标', align:'center',width:100,formatter:formatBid},
				         {field:'returnOpt',title:'是否提交退还申请', align:'center',width:100,formatter:formatOpt},
				         {field:'addWord',title:'中间状态', align:'center',width:100},
				         {field:'status',title:'退还状态', align:'center',width:140,formatter:formatStatus},
				         ]],
			        });
	         
	         $('#mydialog2').datagrid({
                 idField:'id',
                 width:980,
                 url:'${ctx}/business/projectmanage/leader/getProjectBidList?projectId='+projectId+"&type=1",
                 fitColumns:true,//自动填充宽度
                 striped:true,//隔行变色
                 loadMsg:"数据正在加载中.....",
                 rownumbers:true,//显示序号
                 pagination:false,
                 nowrap:false,                    
                 pageSize:5,
                 pageList:[10,15,20],
                 columns:[[   
                 //{field:'ck',checkbox:true }, 
                 {field:'pk',title:'单位名称',width:150,align:'center',formatter:fromatterCompanyName}, 		
              //   {field:'biaoDuanNo',title:'项目标段号', align:'center',width:200},
		         {field:'tnAmount',title:'缴纳金额',width:100,align:'center'},
		         {field:'transTime',title:'缴纳时间',width:150,align:'center'},
		         {field:'hstSeqNum',title:'交易流水号', align:'center',width:100,formatter:fromatterHstSeqNum},
		         {field:'bid',title:'是否投标', align:'center',width:100,formatter:formatBid},
		         {field:'returnOpt',title:'是否提交退还申请', align:'center',width:100,formatter:formatOpt},
		         {field:'addWord',title:'中间状态', align:'center',width:100},
		         {field:'status',title:'退还状态', align:'center',width:140,formatter:formatStatus},
		         ]],
	        });
		 });
	    
	    
	    
	  //流水号
		function fromatterHstSeqNum(val, row, index) {
			if (row.pk) {
				return row.pk.hstSeqNum;
			}
		}
	    
	    function formatStatus(val, row, index) {
			if (row.status == 0) {
				return '<font color="blue">未退还</font>';
			} else if (row.status == 1) {
				return '<font color="green">已退还</font>';
			} else if (row.status == 2) {
				return '<font color="red">扣除</font>';
			}else if(row.status==-1){
				return '<font color="orange">退还失败</font>';
			}

		}

		//是否提交申请格式化	    
		function formatOpt(val, row, index) {
			if (row.returnOpt == 0) {
				return '<font color="blue">未申请</font>';
			} else if (row.returnOpt == 1) {
				return '<font color="green">申请成功</font>';
			}else if (row.returnOpt == -1){
				return '<font color="orange">申请超时</font>';
			}else if(row.returnOpt == 2){
				return '<font color="red">申请失败</font>';
			}
		}
	    
	   //是否投标    
	     function formatBid(val, row, index){
	    	if (row.isBid == false) {
				return '<font color="red">未投标</font>';
					} else if (row.isBid == true) {
						return '<font color="green">已投标</font>';
			       }
	        }
	   
	   //单位名
	     function fromatterCompanyName(val, row, index){
		    	if(row.pk){
				  return row.pk.companyName;
		    	  }  
		        }

       </script>

                 
   
  
